<?php
class DomArOneToOneListener extends DomArObject {
	
	/**
	 * @orm has one DomArOneToOneListener inverse parent
	 * @orm listener beforeSet beforeSetChild(1)
	 * @orm listener afterSet afterSetChild(2)
	 * @orm validator method validatorChild()
	 */
	public $item;
	
	/**
	 * @orm has parent DomArOneToOneListener inverse item
	 * @orm listener beforeSet beforeSetParent(3)
	 * @orm listener afterSet afterSetParent(4)
	 * @orm validator method validatorParent()
	 */
	public $parent;
	
	
	public $beforeSetChild;
	public $afterSetChild;
	public $validatorChild;
	
	public $beforeSetParent;
	public $afterSetParent;
	public $validatorParent;
	
	public $beforeSetChildCount;
	public $afterSetChildCount;
	public $validatorChildCount;
	
	public $beforeSetParentCount;
	public $afterSetParentCount;
	public $validatorParentCount;

	
	public function reset() {
		$this->beforeSetChild = 1;
		$this->afterSetChild = 1;
		$this->validatorChild = 1;
		$this->beforeSetParent = 1;
		$this->afterSetParent = 1;
		$this->validatorParent = 1;
		
		$this->beforeSetChildCount = 0;
		$this->afterSetChildCount = 0;
		$this->validatorChildCount = 0;
		$this->beforeSetParentCount = 0;
		$this->afterSetParentCount = 0;
		$this->validatorParentCount = 0;

	}

	public function beforeSetChild( $value, $a ) {
		$this->beforeSetChild  = $a == 1 ? 0 : 2;
		$this->beforeSetChildCount++;
	}
	
	public function afterSetChild( $a ) {
		$this->afterSetChild  = $a == 2 ? 0 : 2;
		$this->afterSetChildCount++;
	}
	
	public function validatorChild( $value ) {
		$this->validatorChild  = 0;
		$this->validatorChildCount++;
		return 0;
	}
	
	public function beforeSetParent( $value, $a ) {
		$this->beforeSetParent  = $a == 3 ? 0 : 2;
		$this->beforeSetParentCount++;
	}
	
	public function afterSetParent( $a ) {
		$this->afterSetParent  = $a == 4 ? 0 : 2;
		$this->afterSetParentCount++;
	}
	
	public function validatorParent( $value ) {
		$this->validatorParent  = 0;
		$this->validatorParentCount++;
		return 0;
	}
	
	
}
?>